/******************************************************;
*This do file creates data from the 1990 Form 3 Census on number of nurses
******************************************************/

capture clear
clear matrix
clear mata
capture macro drop _all
set mem 1000m
set more off

#delimit ;

***SET DIRECTORY STRUCTURE***;
global data_3
global data_save 

******************************************************;
*1990 Census;
use "${data_3}Census1990_Form3.dta", clear;

*Split out Guimaras from Iloilo and Biliran from Leyte;
*BILIRAN;
replace prv="78" if prv=="37"&inlist(mun, "04", "09", "11","12", "16", "27", "32", "37");
*GUIMARAS;
replace prv="79" if prv=="30"&inlist(mun, "11", "24", "33");

drop if oversea==1;

*OCCUPATION AND NURSE DEGREE VARIABLES;
gen nurse=1 if usual_occ==2231|usual_occ==3231;
gen nurse_midwife=1 if usual_occ==2231|usual_occ==3231|usual_occ==2232|usual_occ==3232;

*COLLAPSE DATA TO GET COUNTS OF NURSES, HEALTH DEGREES, AND THOSE ATTENDING SCHOOL OUT OF PROVINCE BY PROVINCE;
collapse (sum) nurse nurse_midwife [pw=pop_wgt], by(prv);

gen year=1990;

save "${data_save}Census_1990_nurse.dta", replace;
